package com.sinosoft.workflow.biz.service.impl;

import java.util.zip.ZipInputStream;

import org.jbpm.api.ProcessEngine;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.sinosoft.workflow.biz.service.DeploymentWorkflowFacadeService;
import com.sinosoft.workflow.exception.RepositoryException;

/**
 * 
 * 【工作流：流程部署服务接口，包括部署流程、删除流程部署、查询流程部署】
 * @author chihouliang
 * @date 2016年8月16日 上午9:14:36 
 * @version V1.0
 */
@Service
public class DeploymentWorkflowFacadeServiceImpl implements DeploymentWorkflowFacadeService{

    @Autowired
    private ProcessEngine processEngine;
    
    @Override
    public void createDeployment(ZipInputStream zipWorkFlow) throws RepositoryException {
        processEngine.getRepositoryService().createDeployment().addResourcesFromZipInputStream(zipWorkFlow).deploy();
    }

    @Override
    public void delDeployment(String deployId) throws RepositoryException {
       processEngine.getRepositoryService().deleteDeployment(deployId);
    }

}
